package com.android.wellcherish.workclock.bean.data;

import java.util.List;
import java.util.Objects;

/**
 * 被分组后的打卡记录
 *
 * @author 张文琛
 * @date 2020/3/18 22:48
 */
public class GroupRecord {
    private int groupId;

    private boolean isFold;

    private List<IBaseBean> data;

    public GroupRecord(int groupId, List<IBaseBean> data) {
        this.groupId = groupId;
        this.data = data;
    }

    public int getGroupId() {
        return groupId;
    }

    public void setGroupId(int groupId) {
        this.groupId = groupId;
    }

    public boolean isFold() {
        return isFold;
    }

    public void setFold(boolean fold) {
        isFold = fold;
    }

    public List<IBaseBean> getData() {
        return data;
    }

    public void setData(List<IBaseBean> data) {
        this.data = data;
    }

    public void addDataItem(IBaseBean dataItem) {
        if(data != null) {
            this.data.add(dataItem);
        }
    }

    @Override public String toString() {
        return "{\"GroupRecord\":{"
            + "\"groupId\":" + groupId
            + ",\"isFold\":" + isFold
            + ",\"data\":" + data
            + "}}";
    }

    @Override public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof GroupRecord)) return false;
        GroupRecord that = (GroupRecord) o;
        return getGroupId() == that.getGroupId();
    }

    @Override public int hashCode() {
        return Objects.hash(getGroupId(), isFold(), getData());
    }
}
